home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / c-runtime / tests / SubClass2.m < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.2 KB  |  99 lines

  1. /* -*-objc-*- */
  2.  
  3. /* 
  4.   $Header$
  5.   $Author: dglattin $
  6.   $Date$
  7.   $Log$
  8.  */
  9.  
  10. #include  <assert.h>
  11. #include  <stdlib.h>
  12. #include  <strings.h>
  13. #include  <SubClass2.h>
  14.  
  15. #define THE_MESSAGE "Another test message"
  16.  
  17.  
  18. @implementation SubClass2
  19.  
  20.  
  21. + initialize {
  22.  
  23.   printf( "If you see this message then SubClass2 received a"
  24.     " +initialize method\n" );
  25.   
  26.   return self;
  27. }
  28.  
  29.  
  30. + newOther {
  31.  
  32.   self = [ self new ];
  33.  
  34.   return self;
  35. }
  36.  
  37. - hokeyMethod {
  38.  
  39.  
  40.   return self;
  41. }
  42.  
  43.  
  44. - print {
  45.  
  46.  
  47.   printf( "SubClass2 print\n" );
  48.   
  49.   return self;
  50. }
  51.  
  52.  
  53. - print:( const char* )aPhrase {
  54.  
  55.  
  56.   printf( "SubClass2 print:%s\n", aPhrase );
  57.   
  58.   return self;
  59. }
  60.  
  61.  
  62. - print:( const char* )msg1 with:( const char* )msg2 {
  63.  
  64.  
  65.   printf( "SubClass2 print:with:, msg1=%s, msg2=%s\n", msg1, msg2 );
  66.   
  67.   return self;
  68. }
  69.  
  70.  
  71. - storeOn:( int )aFd {
  72.  
  73.   int len;
  74.   
  75.   
  76.   [ super storeOn:aFd ];
  77.   sprintf (dumb, THE_MESSAGE);
  78.   len = write (aFd, dumb, sizeof (dumb));
  79.   assert(len == sizeof (dumb));
  80.   
  81.   return self;
  82. }
  83.  
  84.  
  85. - readFrom:( int )aFd {
  86.  
  87.   int len;
  88.   
  89.   
  90.   [ super readFrom:aFd ];
  91.   len = read (aFd, dumb, sizeof (dumb));
  92.   assert(len == sizeof (dumb));
  93.   assert(!strcmp ( dumb, THE_MESSAGE));
  94.   
  95.   return self;
  96. }
  97.  
  98.  
  99. @end